package org.shuma.user.mng.domain.vo;

import lombok.Data;
import org.shuma.user.mng.constant.RegularConstant;
import org.shuma.user.mng.vaild.group.AuthGroup;

import javax.validation.constraints.*;
import java.util.Date;

/**
 * @author zhao haitao
 * @date 2024/06/17 10:18 AM
 */
@Data
public class AuthVo {
    /**
     * 用户名
     */
    @NotBlank(groups = {AuthGroup.login.class, AuthGroup.updatePassword.class, AuthGroup.register.class}, message = "用户名不能为空")
    public String userName;

    /**
     * 用户头像
     */
    private String avatarUrl;

    /**
     * 密码
     */
    @Size(min = 6, max = 20, groups = {AuthGroup.login.class, AuthGroup.register.class}, message = "密码长度在6-20位之间")
    @Pattern(regexp = RegularConstant.PASSWORD, groups = {AuthGroup.login.class, AuthGroup.register.class}, message = "密码格式不正确")
    @NotBlank(groups = {AuthGroup.login.class, AuthGroup.register.class}, message = "密码不能为空")
    private String userPassword;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 0 - 小二
     * 1 - 超级管理员
     */
    private Integer userRole;
    /**
     * 邮箱
     */
    @Email(regexp = RegularConstant.EMAIL, groups = {AuthGroup.login.class, AuthGroup.register.class})
    private String email;
    /**
     * 验证码6位
     */
    @Min(value = 100000, groups = {AuthGroup.register.class, AuthGroup.updatePassword.class}, message = "验证码为6位数字")
    @Max(value = 1000000, groups = {AuthGroup.register.class, AuthGroup.updatePassword.class}, message = "验证码为6位数字")
    private Integer code;
    /**
     * 新密码
     */
    @Size(min = 6, max = 20, groups = {AuthGroup.updatePassword.class}, message = "密码长度在6-20位之间")
    @Pattern(regexp = RegularConstant.PASSWORD, groups = {AuthGroup.updatePassword.class}, message = "密码格式不正确")
    @NotBlank(groups = {AuthGroup.updatePassword.class}, message = "新密码不能为空")
    private String newPassword;

}
